package com.sise.wangzhan;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Classname InvokerController
 * @Description TODO
 * @Date 2020/3/19 9:58
 * @Created by wangzhan
 */
@RestController
@Configuration
public class InvokerController {

    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }

    @RequestMapping(value = "/router", method = RequestMethod.GET)
    public String queryByPersonId(){
        RestTemplate restTemplate = getRestTemplate();
        String s = restTemplate.getForObject("http://lab02-eureka-provider/person/1314", String.class);

        return s;
    }


}
